package com.practice.backend.Common;

import lombok.Data;

@Data
public class Result {
    //  状态码 0：成功 1：失败
    private int code;
    //  返回信息
    private String msg;
    //  返回数据条目数
    private Integer Total;
    //  返回数据
    private Object data;
    private static Result result(int code, String msg,Integer Total ,Object data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setTotal(Total);
        result.setData(data);
        return result;
    }
    public static Result success(boolean code, String msg,Integer Total , Object data){
        return result(0,msg,Total,data);
    }
    public static Result error(boolean code, String msg,Integer Total , Object data){
        return result(1,msg,Total,data);
    }
}
